home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Include / DShowIDL / Vmrender.idl < prev   
Encoding:
Text File  |  2004-09-27  |  32.5 KB  |  1,093 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Public Interfaces for the Video Mixing Renderer DShow filter
  4. //
  5. // Copyright (c) 1999 - 2002, Microsoft Corporation.  All rights reserved.
  6. ///////////////////////////////////////////////////////////////////////////////
  7.  
  8. cpp_quote("#if 0")
  9. // This is temporary work around to persuade
  10. // MIDL to allow forward declarations.
  11. typedef DWORD*    LPDIRECTDRAW7;
  12. typedef DWORD*    LPDIRECTDRAWSURFACE7;
  13. typedef DWORD*    LPDDPIXELFORMAT;
  14. typedef DWORD*    LPBITMAPINFOHEADER;
  15. typedef struct {DWORD dw1; DWORD dw2;} DDCOLORKEY;
  16. typedef DDCOLORKEY*    LPDDCOLORKEY;
  17. cpp_quote ("#endif")
  18. cpp_quote("#include <ddraw.h>")
  19.  
  20.  
  21. // public interfaces supported by the VMR
  22. interface IVMRSurface;
  23.  
  24. interface IVMRSurfaceAllocator;
  25. interface IVMRSurfaceAllocatorNotify;
  26. interface IVMRImagePresenter;
  27. interface IVMRImagePresenterConfig;
  28.  
  29. interface IVMRWindowlessControl;
  30. interface IVMRMixerControl;
  31. interface IVMRMixerBitmap;
  32. interface IVMRFilterConfig;
  33. interface IVMRAspectRatioControl;
  34. interface IVMRDeinterlaceControl;
  35. interface IVMRMonitorConfig;
  36.  
  37. interface IVMRImageCompositor;
  38.  
  39. interface IVMRVideoStreamControl;
  40.  
  41.  
  42.  
  43.  
  44. ///////////////////////////////////////////////////////////////////////////////
  45. //
  46. // Allocator Presenter interfaces
  47. //
  48. ///////////////////////////////////////////////////////////////////////////////
  49.  
  50.  
  51.  
  52. //=====================================================================
  53. //
  54. // IVMRImagePresenter
  55. //
  56. //=====================================================================
  57. typedef enum {
  58.     VMRSample_SyncPoint       = 0x00000001,
  59.     VMRSample_Preroll         = 0x00000002,
  60.     VMRSample_Discontinuity   = 0x00000004,
  61.     VMRSample_TimeValid       = 0x00000008,
  62.     VMRSample_SrcDstRectsValid= 0x00000010
  63. } VMRPresentationFlags;
  64.  
  65.  
  66. typedef struct tagVMRPRESENTATIONINFO {
  67.     DWORD                   dwFlags;
  68.     LPDIRECTDRAWSURFACE7    lpSurf;
  69.     REFERENCE_TIME          rtStart;
  70.     REFERENCE_TIME          rtEnd;
  71.     SIZE                    szAspectRatio;
  72.     RECT                    rcSrc;
  73.     RECT                    rcDst;
  74.     DWORD                   dwTypeSpecificFlags;
  75.     DWORD                   dwInterlaceFlags;
  76. } VMRPRESENTATIONINFO;
  77.  
  78. [
  79.     local,
  80.     object,
  81.     local,
  82.     uuid(CE704FE7-E71E-41fb-BAA2-C4403E1182F5),
  83.     helpstring("IVMRImagePresenter Interface"),
  84.     pointer_default(unique)
  85. ]
  86. interface IVMRImagePresenter : IUnknown
  87. {
  88.     HRESULT StartPresenting(
  89.         [in] DWORD_PTR dwUserID
  90.         );
  91.  
  92.     HRESULT StopPresenting(
  93.         [in] DWORD_PTR dwUserID
  94.         );
  95.  
  96.  
  97.     HRESULT PresentImage(
  98.         [in] DWORD_PTR dwUserID,
  99.         [in] VMRPRESENTATIONINFO* lpPresInfo
  100.         );
  101. };
  102.  
  103.  
  104. //=====================================================================
  105. //
  106. // IVMRSurfaceAllocator
  107. //
  108. //=====================================================================
  109.  
  110. typedef enum {
  111.     AMAP_PIXELFORMAT_VALID  = 0x01,
  112.     AMAP_3D_TARGET          = 0x02,
  113.     AMAP_ALLOW_SYSMEM       = 0x04,
  114.     AMAP_FORCE_SYSMEM       = 0x08,
  115.     AMAP_DIRECTED_FLIP      = 0x10,
  116.     AMAP_DXVA_TARGET        = 0x20
  117. } VMRSurfaceAllocationFlags;
  118.  
  119. typedef struct tagVMRALLOCATIONINFO {
  120.     DWORD                   dwFlags;
  121.     LPBITMAPINFOHEADER      lpHdr;
  122.     LPDDPIXELFORMAT         lpPixFmt;
  123.     SIZE                    szAspectRatio;
  124.     DWORD                   dwMinBuffers;
  125.     DWORD                   dwMaxBuffers;
  126.     DWORD                   dwInterlaceFlags;
  127.     SIZE                    szNativeSize;
  128. } VMRALLOCATIONINFO;
  129.  
  130. [
  131.     local,
  132.     object,
  133.     local,
  134.     uuid(31ce832e-4484-458b-8cca-f4d7e3db0b52),
  135.     helpstring("IVMRSurfaceAllocator Interface"),
  136.     pointer_default(unique)
  137. ]
  138. interface IVMRSurfaceAllocator : IUnknown
  139. {
  140.     HRESULT AllocateSurface(
  141.         [in] DWORD_PTR dwUserID,
  142.         [in] VMRALLOCATIONINFO* lpAllocInfo,
  143.         [in] [out] DWORD* lpdwActualBuffers,
  144.         [out] LPDIRECTDRAWSURFACE7 *lplpSurface
  145.         );
  146.  
  147.     HRESULT FreeSurface(
  148.         [in] DWORD_PTR dwID
  149.         );
  150.  
  151.     HRESULT PrepareSurface(
  152.         [in] DWORD_PTR dwUserID,
  153.         [in] LPDIRECTDRAWSURFACE7 lpSurface,
  154.         [in] DWORD dwSurfaceFlags
  155.         );
  156.  
  157.     HRESULT AdviseNotify(
  158.         [in] IVMRSurfaceAllocatorNotify* lpIVMRSurfAllocNotify
  159.         );
  160. };
  161.  
  162.  
  163. //=====================================================================
  164. //
  165. // IVMRSurfaceAllocatorNotify
  166. //
  167. //=====================================================================
  168. [
  169.     local,
  170.     object,
  171.     local,
  172.     uuid(aada05a8-5a4e-4729-af0b-cea27aed51e2),
  173.     helpstring("IVMRSurfaceAllocatorNotify Interface"),
  174.     pointer_default(unique)
  175. ]
  176. interface IVMRSurfaceAllocatorNotify : IUnknown
  177. {
  178.     HRESULT AdviseSurfaceAllocator(
  179.         [in] DWORD_PTR dwUserID,
  180.         [in] IVMRSurfaceAllocator* lpIVRMSurfaceAllocator
  181.         );
  182.  
  183.     HRESULT SetDDrawDevice(
  184.         [in] LPDIRECTDRAW7 lpDDrawDevice,
  185.         [in] HMONITOR hMonitor
  186.         );
  187.  
  188.     HRESULT ChangeDDrawDevice(
  189.         [in] LPDIRECTDRAW7 lpDDrawDevice,
  190.         [in] HMONITOR hMonitor
  191.         );
  192.  
  193.     HRESULT RestoreDDrawSurfaces();
  194.  
  195.     HRESULT NotifyEvent(
  196.         [in] LONG EventCode,
  197.         [in] LONG_PTR Param1,
  198.         [in] LONG_PTR Param2
  199.         );
  200.  
  201.     HRESULT SetBorderColor(
  202.         [in] COLORREF clrBorder
  203.         );
  204. };
  205.  
  206.  
  207.  
  208. ///////////////////////////////////////////////////////////////////////////////
  209. //
  210. // Application control and configuration interfaces
  211. //
  212. ///////////////////////////////////////////////////////////////////////////////
  213.  
  214.  
  215. //=====================================================================
  216. //
  217. // IVMRWindowlessControl
  218. //
  219. //=====================================================================
  220. typedef enum {
  221.     VMR_ARMODE_NONE,
  222.     VMR_ARMODE_LETTER_BOX
  223. } VMR_ASPECT_RATIO_MODE;
  224.  
  225. [
  226.     local,
  227.     object,
  228.     local,
  229.     uuid(0eb1088c-4dcd-46f0-878f-39dae86a51b7),
  230.     helpstring("IVMRWindowlessControl Interface"),
  231.     pointer_default(unique)
  232. ]
  233. interface IVMRWindowlessControl : IUnknown
  234. {
  235.     //
  236.     //////////////////////////////////////////////////////////
  237.     // Video size and position information
  238.     //////////////////////////////////////////////////////////
  239.     //
  240.     HRESULT GetNativeVideoSize(
  241.         [out] LONG* lpWidth,
  242.         [out] LONG* lpHeight,
  243.         [out] LONG* lpARWidth,
  244.         [out] LONG* lpARHeight
  245.         );
  246.  
  247.     HRESULT GetMinIdealVideoSize(
  248.         [out] LONG* lpWidth,
  249.         [out] LONG* lpHeight
  250.         );
  251.  
  252.     HRESULT GetMaxIdealVideoSize(
  253.         [out] LONG* lpWidth,
  254.         [out] LONG* lpHeight
  255.         );
  256.  
  257.     HRESULT SetVideoPosition(
  258.         [in] const LPRECT lpSRCRect,
  259.         [in] const LPRECT lpDSTRect
  260.         );
  261.  
  262.     HRESULT GetVideoPosition(
  263.         [out] LPRECT lpSRCRect,
  264.         [out] LPRECT lpDSTRect
  265.         );
  266.  
  267.     HRESULT GetAspectRatioMode(
  268.         [out] DWORD* lpAspectRatioMode
  269.         );
  270.  
  271.     HRESULT SetAspectRatioMode(
  272.         [in] DWORD AspectRatioMode
  273.         );
  274.  
  275.     //
  276.     //////////////////////////////////////////////////////////
  277.     // Display and clipping management
  278.     //////////////////////////////////////////////////////////
  279.     //
  280.     HRESULT SetVideoClippingWindow(
  281.         [in] HWND hwnd
  282.         );
  283.  
  284.     HRESULT RepaintVideo(
  285.         [in] HWND hwnd,
  286.         [in] HDC hdc
  287.         );
  288.  
  289.     HRESULT DisplayModeChanged();
  290.  
  291.  
  292.     //
  293.     //////////////////////////////////////////////////////////
  294.     // GetCurrentImage
  295.     //
  296.     // Returns the current image being displayed.  This images
  297.     // is returned in the form of packed Windows DIB.
  298.     //
  299.     // GetCurrentImage can be called at any time, also
  300.     // the caller is responsible for free the returned memory
  301.     // by calling CoTaskMemFree.
  302.     //
  303.     // Excessive use of this function will degrade video
  304.     // playback performed.
  305.     //////////////////////////////////////////////////////////
  306.     //
  307.     HRESULT GetCurrentImage(
  308.         [out] BYTE** lpDib
  309.         );
  310.  
  311.     //
  312.     //////////////////////////////////////////////////////////
  313.     // Border Color control
  314.     //
  315.     // The border color is color used to fill any area of the
  316.     // the destination rectangle that does not contain video.
  317.     // It is typically used in two instances.  When the video
  318.     // straddles two monitors and when the VMR is trying
  319.     // to maintain the aspect ratio of the movies by letter
  320.     // boxing the video to fit within the specified destination
  321.     // rectangle. See SetAspectRatioMode above.
  322.     //////////////////////////////////////////////////////////
  323.     //
  324.     HRESULT SetBorderColor(
  325.         [in] COLORREF Clr
  326.         );
  327.  
  328.     HRESULT GetBorderColor(
  329.         [out] COLORREF* lpClr
  330.         );
  331.  
  332.     //
  333.     //////////////////////////////////////////////////////////
  334.     // Color key control only meaningful when the VMR is using
  335.     // and overlay
  336.     //////////////////////////////////////////////////////////
  337.     //
  338.     HRESULT SetColorKey(
  339.         [in] COLORREF Clr
  340.         );
  341.  
  342.     HRESULT GetColorKey(
  343.         [out] COLORREF* lpClr
  344.         );
  345. };
  346.  
  347.  
  348.  
  349. //=====================================================================
  350. //
  351. // IVMRMixerControl
  352. //
  353. //=====================================================================
  354.  
  355. typedef enum {
  356.     MixerPref_NoDecimation                 = 0x00000001, // No decimation - full size
  357.     MixerPref_DecimateOutput               = 0x00000002, // decimate output by 2 in x & y
  358.     MixerPref_ARAdjustXorY          = 0x00000004, // adjust the aspect ratio in x or y
  359.     MixerPref_DecimationReserved    = 0x00000008, // bits reserved for future use.
  360.     MixerPref_DecimateMask                 = 0x0000000F,
  361.  
  362.     MixerPref_BiLinearFiltering            = 0x00000010, // use bi-linear filtering
  363.     MixerPref_PointFiltering               = 0x00000020, // use point filtering
  364.     MixerPref_FilteringMask                = 0x000000F0, // OR of all above flags
  365.  
  366.     MixerPref_RenderTargetRGB       = 0x00000100, // Uses D3D to perform mixing
  367.     MixerPref_RenderTargetYUV       = 0x00001000, // Uses DXVA to perform mixing
  368.  
  369.     MixerPref_RenderTargetYUV420    = 0x00000200, // Deprecated render target
  370.     MixerPref_RenderTargetYUV422    = 0x00000400, // Deprecated render target
  371.     MixerPref_RenderTargetYUV444    = 0x00000800, // Deprecated render target
  372.     MixerPref_RenderTargetReserved  = 0x0000E000, // 3 bits reserved for future use.
  373.     MixerPref_RenderTargetMask      = 0x0000FF00, // OR of all above flags
  374.  
  375.     //
  376.     // Dynamic changes that can be performed when the VMR's mixer is
  377.     // configured to use the YUV Render target (see MixerPref_RenderTargetYUV)
  378.     // These preferences can be applied while the graph is running and take effect
  379.     // when the next frame is composed by the mixer.
  380.     //
  381.     MixerPref_DynamicSwitchToBOB           = 0x00010000,
  382.     MixerPref_DynamicDecimateBy2           = 0x00020000,
  383.  
  384.     MixerPref_DynamicReserved              = 0x000C0000,
  385.     MixerPref_DynamicMask                  = 0x000F0000
  386.  
  387. } VMRMixerPrefs;
  388.  
  389. //
  390. //  Normalized relative rectangle
  391. //  Coordinate ranges: x=[0...1) y=[0...1)
  392. //  Where the output window goes from 0,0 (closed inclusive lower bound)
  393. //  to 1,1 (open exclusive upper bound)
  394. //
  395. typedef struct _NORMALIZEDRECT
  396. {
  397.     float left;
  398.     float top;
  399.     float right;
  400.     float bottom;
  401. } NORMALIZEDRECT, *PNORMALIZEDRECT;
  402.  
  403. [
  404.     local,
  405.     object,
  406.     local,
  407.     uuid(1c1a17b0-bed0-415d-974b-dc6696131599),
  408.     helpstring("IVMRMixerControl Interface"),
  409.     pointer_default(unique)
  410. ]
  411. interface IVMRMixerControl : IUnknown
  412. {
  413.     HRESULT SetAlpha(
  414.         [in] DWORD dwStreamID,
  415.         [in] float Alpha // Source alpha premultication factor (global alpha for source)
  416.         );
  417.  
  418.     HRESULT GetAlpha(
  419.         [in] DWORD dwStreamID,
  420.         [out] float* pAlpha
  421.         );
  422.  
  423.     HRESULT SetZOrder(
  424.         [in] DWORD dwStreamID,
  425.         [in] DWORD dwZ
  426.         );
  427.  
  428.     HRESULT GetZOrder(
  429.         [in] DWORD dwStreamID,
  430.         [out] DWORD* pZ
  431.         );
  432.  
  433.     HRESULT SetOutputRect(
  434.         [in] DWORD dwStreamID,
  435.         [in] const NORMALIZEDRECT *pRect
  436.         );
  437.  
  438.     HRESULT GetOutputRect(
  439.         [in] DWORD dwStreamID,
  440.         [out] NORMALIZEDRECT *pRect
  441.         );
  442.  
  443.     HRESULT SetBackgroundClr(
  444.         [in] COLORREF ClrBkg
  445.         );
  446.  
  447.     HRESULT GetBackgroundClr(
  448.         [in] COLORREF* lpClrBkg
  449.         );
  450.  
  451.     HRESULT SetMixingPrefs(
  452.         [in] DWORD dwMixerPrefs  // a combination of VMRMixingPrefFlags
  453.         );
  454.  
  455.     HRESULT GetMixingPrefs(
  456.         [out] DWORD* pdwMixerPrefs
  457.         );
  458. };
  459.  
  460.  
  461. ///////////////////////////////////////////////////////////////////////////////
  462. //
  463. // VMR Multimon configuration interface
  464. //
  465. ///////////////////////////////////////////////////////////////////////////////
  466. typedef struct tagVMRGUID {
  467.     GUID*       pGUID; // is NULL if the default DDraw device
  468.     GUID        GUID;   // otherwise points to this GUID
  469. } VMRGUID;
  470.  
  471. #define VMRDEVICENAMELEN 32
  472. #define VMRDEVICEDESCRIPTIONLEN  256
  473.  
  474. typedef struct tagVMRMONITORINFO {
  475.     VMRGUID     guid;
  476.     RECT        rcMonitor;
  477.     HMONITOR    hMon;
  478.     DWORD       dwFlags;    // described in MONITORINFOEX, currently only MONITORINFOF_PRIMARY
  479.     wchar_t     szDevice[VMRDEVICENAMELEN];
  480.     wchar_t     szDescription[VMRDEVICEDESCRIPTIONLEN];
  481.     LARGE_INTEGER liDriverVersion;
  482.     DWORD       dwVendorId;
  483.     DWORD       dwDeviceId;
  484.     DWORD       dwSubSysId;
  485.     DWORD       dwRevision;
  486.     // find out the DDCAPS using DDrawCreate on the monitor GUID
  487. } VMRMONITORINFO;
  488.  
  489. [
  490.     object,
  491.     local,
  492.     uuid(9cf0b1b6-fbaa-4b7f-88cf-cf1f130a0dce),
  493.     helpstring("IVMRMonitorConfig Interface"),
  494.     pointer_default(unique)
  495. ]
  496. interface IVMRMonitorConfig : IUnknown
  497. {
  498.     // Use this method on a Multi-Monitor system to specify to the
  499.     // mixer filter which Direct Draw driver should be used when connecting
  500.     // to an upstream decoder filter.
  501.     //
  502.     HRESULT SetMonitor(
  503.         [in] const VMRGUID *pGUID
  504.         );
  505.  
  506.     // Use this method to determine the direct draw object that will be used when
  507.     // connecting the  mixer filter to an upstream decoder filter.
  508.     //
  509.     HRESULT GetMonitor(
  510.         [out] VMRGUID *pGUID
  511.         );
  512.  
  513.     // Use this method on a multi-monitor system to specify to the
  514.     //  mixer filter the default Direct Draw device to use when
  515.     // connecting to an upstream filter.  The default direct draw device
  516.     // can be overriden for a particular connection by SetMonitor method
  517.     // described above.
  518.     //
  519.     HRESULT SetDefaultMonitor(
  520.         [in] const VMRGUID *pGUID
  521.         );
  522.  
  523.     // Use this method on a multi-monitor system to determine which
  524.     // is the default direct draw device the overlay mixer filter
  525.     // will  use when connecting to an upstream filter.
  526.     //
  527.     HRESULT GetDefaultMonitor(
  528.         [out] VMRGUID *pGUID
  529.         );
  530.  
  531.     // Use this method to get a list of Direct Draw device GUIDs and thier
  532.     // associated monitor information that the mixer can use when
  533.     // connecting to an upstream decoder filter.  Passing down a NULL pInfo
  534.     // parameter allows the app to determine the required array size (returned
  535.     // in pdwNumDevices).  Otherwise, dwNumDevices returns the actual
  536.     // number of devices retrieved.
  537.     //
  538.     HRESULT GetAvailableMonitors(
  539.         [out, size_is(dwMaxInfoArraySize)] VMRMONITORINFO* pInfo,
  540.         [in] DWORD dwMaxInfoArraySize, // in array members
  541.         [out] DWORD* pdwNumDevices // actual number of devices retrieved
  542.         );
  543. };
  544.  
  545.  
  546.  
  547.  
  548. ///////////////////////////////////////////////////////////////////////////////
  549. //
  550. // VMR Filter configuration interfaces
  551. //
  552. ///////////////////////////////////////////////////////////////////////////////
  553.  
  554.  
  555. typedef enum {
  556.     RenderPrefs_RestrictToInitialMonitor     = 0x00000000, // not implemented do not use
  557.     RenderPrefs_ForceOffscreen               = 0x00000001,
  558.     RenderPrefs_ForceOverlays                = 0x00000002, // fail if no overlays
  559.     RenderPrefs_AllowOverlays                = 0x00000000, // overlay used by default
  560.     RenderPrefs_AllowOffscreen               = 0x00000000, // offscreen used if no overlay
  561.     RenderPrefs_DoNotRenderColorKeyAndBorder = 0x00000008, // app paints color keys
  562.     RenderPrefs_Reserved                     = 0x00000010, // note: used to be RestrictToInitialMonitor
  563.     RenderPrefs_PreferAGPMemWhenMixing       = 0x00000020, // try agp mem when allocating textures
  564.  
  565.     RenderPrefs_Mask                         = 0x0000003f, // OR of all above flags
  566. } VMRRenderPrefs;
  567.  
  568. typedef enum {
  569.     VMRMode_Windowed                         = 0x00000001,
  570.     VMRMode_Windowless                       = 0x00000002,
  571.     VMRMode_Renderless                       = 0x00000004,
  572.  
  573.     // not a valid value to pass to SetRenderMode
  574.     VMRMode_Mask                             = 0x00000007, // OR of all above flags
  575. } VMRMode;
  576.  
  577. enum {
  578.         MAX_NUMBER_OF_STREAMS = 16
  579. };
  580.  
  581. [
  582.     object,
  583.     local,
  584.     uuid(9e5530c5-7034-48b4-bb46-0b8a6efc8e36),
  585.     helpstring("IVMRFilterConfig Interface"),
  586.     pointer_default(unique)
  587. ]
  588. interface IVMRFilterConfig : IUnknown
  589. {
  590.     HRESULT SetImageCompositor(
  591.         [in] IVMRImageCompositor* lpVMRImgCompositor
  592.         );
  593.  
  594.     HRESULT SetNumberOfStreams(
  595.         [in] DWORD dwMaxStreams
  596.         );
  597.  
  598.     HRESULT GetNumberOfStreams(
  599.         [out] DWORD* pdwMaxStreams
  600.         );
  601.  
  602.     HRESULT SetRenderingPrefs(
  603.         [in] DWORD dwRenderFlags  // a combination of VMRRenderingPrefFlags
  604.         );
  605.  
  606.     HRESULT GetRenderingPrefs(
  607.         [out] DWORD* pdwRenderFlags
  608.         );
  609.  
  610.     HRESULT SetRenderingMode(
  611.         [in] DWORD Mode  // a combination of VMRMode
  612.         );
  613.  
  614.     HRESULT GetRenderingMode(
  615.         [out] DWORD* pMode
  616.         );
  617. }
  618.  
  619.  
  620. //=====================================================================
  621. //
  622. // IVMRAspectRatioControl
  623. //
  624. //=====================================================================
  625. [
  626.     object,
  627.     local,
  628.     uuid(ede80b5c-bad6-4623-b537-65586c9f8dfd),
  629.     helpstring("IVMRAspectRatioControl Interface"),
  630.     pointer_default(unique)
  631. ]
  632. interface IVMRAspectRatioControl : IUnknown
  633. {
  634.     HRESULT GetAspectRatioMode(
  635.         [out] LPDWORD lpdwARMode
  636.             );
  637.  
  638.     HRESULT SetAspectRatioMode(
  639.         [in] DWORD dwARMode
  640.             );
  641. }
  642.  
  643.  
  644. //=====================================================================
  645. //
  646. // IVMRDeinterlaceControl
  647. //
  648. // New interfaced introduced into the WindowsXP SP1 release of the VMR.
  649. // This interface allows applications to control the DX-VA deinterlacing
  650. // support provided by the VMR.
  651. //
  652. // The VMR needs to be set into "mixing" mode for this interface to work.
  653. //
  654. // SetDeinterlaceMode is only effective for new connections made to the
  655. // VMR.  It should be noted that the graphics device driver may refuse
  656. // to use the specified deinterlace mode, in which case 3 fallback
  657. // policies are offered by the VMR, these being:
  658. //
  659. //      1. Fallback to the next best mode offered by the driver.
  660. //      2. Fallback to the BOB deinterlace mode.
  661. //      3. Fallback to the WEAVE deinterlace mode (ie. turn deinterlacing off).
  662. //
  663. //=====================================================================
  664.  
  665. typedef enum {
  666.     DeinterlacePref_NextBest = 0x01,
  667.     DeinterlacePref_BOB = 0x02,
  668.     DeinterlacePref_Weave = 0x04,
  669.     DeinterlacePref_Mask = 0x07
  670. } VMRDeinterlacePrefs;
  671.  
  672. typedef enum {
  673.  
  674.     // the algorithm is unknown or proprietary
  675.     DeinterlaceTech_Unknown                = 0x0000,
  676.  
  677.     // the algorithm creates the missing lines by repeating
  678.     // the line either above or below it - this method will look very jaggy and
  679.     // isn't recommended
  680.     DeinterlaceTech_BOBLineReplicate       = 0x0001,
  681.  
  682.  
  683.     // the algorithm creates the missing lines by vertically stretching each
  684.     // video field by a factor of two, for example by averaging two lines or
  685.     // using a [-1, 9, 9, -1]/16 filter across four lines.
  686.     // Slight vertical adjustments are made to ensure that the resulting image
  687.     // does not "bob" up and down.
  688.     DeinterlaceTech_BOBVerticalStretch     = 0x0002,
  689.  
  690.     // the pixels in the missing line are recreated by a median filtering operation
  691.     DeinterlaceTech_MedianFiltering        = 0x0004,
  692.  
  693.     // the pixels in the missing line are recreated by an edge filter.
  694.     // In this process, spatial directional filters are applied to determine
  695.     // the orientation of edges in the picture content, and missing
  696.     // pixels are created by filtering along (rather than across) the
  697.     // detected edges.
  698.     DeinterlaceTech_EdgeFiltering          = 0x0010,
  699.  
  700.     // the pixels in the missing line are recreated by switching on a field by
  701.     // field basis between using either spatial or temporal interpolation
  702.     // depending on the amount of motion.
  703.     DeinterlaceTech_FieldAdaptive          = 0x0020,
  704.  
  705.     // the pixels in the missing line are recreated by switching on a pixel by pixel
  706.     // basis between using either spatial or temporal interpolation depending on
  707.     // the amount of motion..
  708.     DeinterlaceTech_PixelAdaptive          = 0x0040,
  709.  
  710.     // Motion Vector Steering  identifies objects within a sequence of video
  711.     // fields.  The missing pixels are recreated after first aligning the
  712.     // movement axes of the individual objects in the scene to make them
  713.     // parallel with the time axis.
  714.     DeinterlaceTech_MotionVectorSteered      = 0x0080
  715.  
  716. } VMRDeinterlaceTech;
  717.  
  718. typedef struct _VMRFrequency {
  719.     DWORD dwNumerator;
  720.     DWORD dwDenominator;
  721. } VMRFrequency;
  722.  
  723. typedef struct _VMRVideoDesc {
  724.     DWORD               dwSize;
  725.     DWORD               dwSampleWidth;
  726.     DWORD               dwSampleHeight;
  727.     BOOL                SingleFieldPerSample;
  728.     DWORD               dwFourCC;
  729.     VMRFrequency        InputSampleFreq;
  730.     VMRFrequency        OutputFrameFreq;
  731. } VMRVideoDesc;
  732.  
  733. typedef struct _VMRDeinterlaceCaps {
  734.     DWORD               dwSize;
  735.     DWORD               dwNumPreviousOutputFrames;
  736.     DWORD               dwNumForwardRefSamples;
  737.     DWORD               dwNumBackwardRefSamples;
  738.     VMRDeinterlaceTech  DeinterlaceTechnology;
  739. } VMRDeinterlaceCaps;
  740.  
  741. [
  742.     object,
  743.     local,
  744.     uuid(bb057577-0db8-4e6a-87a7-1a8c9a505a0f),
  745.     helpstring("IVMRDeinterlaceControl Interface"),
  746.     pointer_default(unique)
  747. ]
  748. interface IVMRDeinterlaceControl : IUnknown
  749. {
  750.     //
  751.     // For the specified video description returns the
  752.     // number of deinterlacing modes available to the VMR.
  753.     // The deinterlacing modes are returned in descending
  754.     // quality order ie. the best quality mode is at
  755.     // lpdwNumDeinterlaceModes[0], the next best at
  756.     // lpdwNumDeinterlaceModes[1] and so on.
  757.     //
  758.     // To determine how big an array of guids to pass to the
  759.     // GetNumberOfDeinterlaceModes method call
  760.     // GetNumberOfDeinterlaceModes(lpVideoDescription, &dwNumModes, NULL);
  761.     //
  762.     HRESULT GetNumberOfDeinterlaceModes(
  763.         [in] VMRVideoDesc* lpVideoDescription,
  764.         [in] [out] LPDWORD lpdwNumDeinterlaceModes,
  765.         [out] LPGUID lpDeinterlaceModes
  766.         );
  767.  
  768.     //
  769.     // For the given video description get the capabilities of the
  770.     // specified de-interlace mode.
  771.     //
  772.     HRESULT GetDeinterlaceModeCaps(
  773.         [in] LPGUID lpDeinterlaceMode,
  774.         [in] VMRVideoDesc* lpVideoDescription,
  775.         [in] [out] VMRDeinterlaceCaps* lpDeinterlaceCaps
  776.         );
  777.  
  778.     //
  779.     // Get/Set the deinterlace mode that you would like the
  780.     // VMR to use when de-interlacing the specified stream.
  781.     // It should be noted that the VMR may not actually be able
  782.     // to use the requested deinterlace mode, in which case the
  783.     // the VMR will fall back to other de-interlace modes as specified
  784.     // by the de-interlace preferences (see SetDeinterlacePrefs below).
  785.     //
  786.     HRESULT GetDeinterlaceMode(
  787.         [in] DWORD dwStreamID,
  788.         [out] LPGUID lpDeinterlaceMode  // returns GUID_NULL if SetDeinterlaceMode
  789.         );                              // has not been called yet.
  790.  
  791.     HRESULT SetDeinterlaceMode(
  792.         [in] DWORD dwStreamID,          // use 0xFFFFFFFF to set mode for all streams
  793.         [in] LPGUID lpDeinterlaceMode   // GUID_NULL == turn deinterlacing off
  794.         );
  795.  
  796.  
  797.     HRESULT GetDeinterlacePrefs(
  798.         [out] LPDWORD lpdwDeinterlacePrefs
  799.         );
  800.  
  801.     HRESULT SetDeinterlacePrefs(
  802.         [in] DWORD dwDeinterlacePrefs
  803.         );
  804.  
  805.     //
  806.     // Get the DeinterlaceMode currently in use for the specified
  807.     // video stream (ie. pin).  The returned GUID will be NULL if
  808.     // the de-interlacing h/w has not been created by the VMR at the
  809.     // time the function is called, or if the VMR determines that
  810.     // this stream should not or can be de-interlaced.
  811.     //
  812.     HRESULT GetActualDeinterlaceMode(
  813.         [in] DWORD dwStreamID,
  814.         [out] LPGUID lpDeinterlaceMode
  815.         );
  816. }
  817.  
  818.  
  819. //=====================================================================
  820. //
  821. // IVMRMixerBitmap
  822. //
  823. //=====================================================================
  824. typedef struct _VMRALPHABITMAP
  825. {
  826.     DWORD                   dwFlags;    // flags word
  827.     HDC                     hdc;        // DC for the bitmap to copy
  828.     LPDIRECTDRAWSURFACE7    pDDS;       // DirectDraw surface to copy
  829.     RECT                    rSrc;       // rectangle to copy from the DC/DDS
  830.     NORMALIZEDRECT          rDest;      // output rectangle in composition space
  831.     FLOAT                fAlpha;     // opacity of the bitmap
  832.     COLORREF                clrSrcKey;  // src color key
  833. } VMRALPHABITMAP, *PVMRALPHABITMAP;
  834.  
  835. // Disable the alpha bitmap for now
  836. cpp_quote("#define VMRBITMAP_DISABLE            0x00000001")
  837.  
  838. // Take the bitmap from the HDC rather than the DirectDraw surface
  839. cpp_quote("#define VMRBITMAP_HDC                0x00000002")
  840.  
  841. // Take the entire DDraw surface - rSrc is ignored
  842. cpp_quote("#define VMRBITMAP_ENTIREDDS          0x00000004")
  843.  
  844. // Indicates that the clrTrans value is valid and should be
  845. // used when blending
  846. cpp_quote("#define VMRBITMAP_SRCCOLORKEY        0x00000008")
  847.  
  848. // Indicates that the rSrc rectangle is valid and specifies a
  849. // sub-rectangle of the of original app image to be blended.
  850. // Use of this parameter enables "Image Strips"
  851. cpp_quote("#define VMRBITMAP_SRCRECT            0x00000010")
  852.  
  853. [
  854.     object,
  855.     local,
  856.     uuid(1E673275-0257-40aa-AF20-7C608D4A0428),
  857.     helpstring("IVMRMixerBitmap Interface"),
  858.     pointer_default(unique)
  859. ]
  860. interface IVMRMixerBitmap : IUnknown
  861. {
  862.     // Set bitmap, location to blend it, and blending value
  863.     HRESULT SetAlphaBitmap(
  864.         [in] const VMRALPHABITMAP *pBmpParms
  865.         );
  866.  
  867.     // Change bitmap location, size and blending value,
  868.     // graph must be running for change to take effect.
  869.     HRESULT UpdateAlphaBitmapParameters(
  870.         [in] PVMRALPHABITMAP pBmpParms
  871.         );
  872.  
  873.     // Get bitmap, location to blend it, and blending value
  874.     HRESULT GetAlphaBitmapParameters(
  875.         [out] PVMRALPHABITMAP pBmpParms
  876.         );
  877. };
  878.  
  879.  
  880.  
  881.  
  882.  
  883. //=====================================================================
  884. //
  885. // IVMRImageCompositor
  886. //
  887. //=====================================================================
  888.  
  889. typedef struct _VMRVIDEOSTREAMINFO {
  890.     LPDIRECTDRAWSURFACE7        pddsVideoSurface;
  891.     DWORD                       dwWidth, dwHeight;
  892.     DWORD                       dwStrmID;
  893.     FLOAT                       fAlpha;
  894.     DDCOLORKEY                  ddClrKey;
  895.     NORMALIZEDRECT              rNormal;
  896. } VMRVIDEOSTREAMINFO;
  897. [
  898.     local,
  899.     object,
  900.     local,
  901.     uuid(7a4fb5af-479f-4074-bb40-ce6722e43c82),
  902.     helpstring("IVMRImageCompositor Interface"),
  903.     pointer_default(unique)
  904. ]
  905. interface IVMRImageCompositor : IUnknown
  906. {
  907.     HRESULT InitCompositionTarget(
  908.         [in] IUnknown* pD3DDevice,
  909.         [in] LPDIRECTDRAWSURFACE7 pddsRenderTarget
  910.         );
  911.  
  912.     HRESULT TermCompositionTarget(
  913.         [in] IUnknown* pD3DDevice,
  914.         [in] LPDIRECTDRAWSURFACE7 pddsRenderTarget
  915.         );
  916.  
  917.     HRESULT SetStreamMediaType(
  918.         [in] DWORD dwStrmID,
  919.         [in] AM_MEDIA_TYPE* pmt,
  920.         [in] BOOL fTexture
  921.         );
  922.  
  923.     HRESULT CompositeImage(
  924.         [in] IUnknown* pD3DDevice,
  925.         [in] LPDIRECTDRAWSURFACE7 pddsRenderTarget,
  926.         [in] AM_MEDIA_TYPE* pmtRenderTarget,
  927.         [in] REFERENCE_TIME rtStart,
  928.         [in] REFERENCE_TIME rtEnd,
  929.         [in] DWORD dwClrBkGnd,
  930.         [in] VMRVIDEOSTREAMINFO* pVideoStreamInfo,
  931.         [in] UINT cStreams
  932.         );
  933. };
  934.  
  935.  
  936.  
  937. //=====================================================================
  938. //
  939. // IVMRVideoStreamControl
  940. //
  941. //=====================================================================
  942. [
  943.     object,
  944.     local,
  945.     uuid(058d1f11-2a54-4bef-bd54-df706626b727),
  946.     helpstring("IVMRMixerStreamConfig Interface"),
  947.     pointer_default(unique)
  948. ]
  949. interface IVMRVideoStreamControl: IUnknown
  950. {
  951.     HRESULT SetColorKey(
  952.         [in] LPDDCOLORKEY lpClrKey // Source color key, set to 0xFFFFFFFF to disable
  953.         );
  954.  
  955.     HRESULT GetColorKey(
  956.         [out] LPDDCOLORKEY lpClrKey
  957.         );
  958.  
  959.  
  960.     HRESULT SetStreamActiveState(
  961.         [in] BOOL fActive
  962.         );
  963.  
  964.     HRESULT GetStreamActiveState(
  965.         [out] BOOL* lpfActive
  966.         );
  967. };
  968.  
  969.  
  970.  
  971. //=====================================================================
  972. //
  973. // IVMRSurface
  974. //
  975. //=====================================================================
  976. [
  977.     local,
  978.     object,
  979.     local,
  980.     uuid(a9849bbe-9ec8-4263-b764-62730f0d15d0),
  981.     helpstring("IVMRSurface Interface"),
  982.     pointer_default(unique)
  983. ]
  984. interface IVMRSurface : IUnknown
  985. {
  986.     HRESULT IsSurfaceLocked();
  987.  
  988.     HRESULT LockSurface(
  989.         [out] BYTE** lpSurface
  990.         );
  991.  
  992.     HRESULT UnlockSurface();
  993.  
  994.     HRESULT GetSurface(
  995.         [out] LPDIRECTDRAWSURFACE7 *lplpSurface
  996.         );
  997. };
  998.  
  999.  
  1000.  
  1001. //=====================================================================
  1002. //
  1003. // IID_IVMRImagePresenterConfig - this interface allows applications
  1004. // to configure the default Microsoft provided allocator-presenter
  1005. // inorder to simplify the implementation of their own
  1006. // allocator-presenter plug-in.
  1007. //
  1008. //=====================================================================
  1009. [
  1010.     local,
  1011.     object,
  1012.     local,
  1013.     uuid(9f3a1c85-8555-49ba-935f-be5b5b29d178),
  1014.     helpstring("IVMRImagePresenterConfig Interface"),
  1015.     pointer_default(unique)
  1016. ]
  1017.  
  1018. interface IVMRImagePresenterConfig : IUnknown
  1019. {
  1020.  
  1021.     HRESULT SetRenderingPrefs(
  1022.         [in] DWORD dwRenderFlags   // see VMRRenderPrefs for valid flags
  1023.         );
  1024.  
  1025.     HRESULT GetRenderingPrefs(
  1026.         [out] DWORD* dwRenderFlags // see VMRRenderPrefs for valid flags
  1027.         );
  1028.  
  1029. }
  1030.  
  1031. //=====================================================================
  1032. //
  1033. // IID_IVMRImagePresenterExclModeConfig - this interface allows applications
  1034. // to configure the DDraw exclusive mode allocator-presenter.  This
  1035. // interface extends the IVMRImagePresenterConfig interface defined
  1036. // above and is only implemented by the CLSID_AllocPresenterDDXclMode
  1037. // allocator-presenter object.
  1038. //
  1039. //=====================================================================
  1040. [
  1041.     local,
  1042.     object,
  1043.     local,
  1044.     uuid(e6f7ce40-4673-44f1-8f77-5499d68cb4ea),
  1045.     helpstring("IVMRImagePresenterExclModeConfig Interface"),
  1046.     pointer_default(unique)
  1047. ]
  1048.  
  1049. interface IVMRImagePresenterExclModeConfig : IVMRImagePresenterConfig
  1050. {
  1051.     HRESULT SetXlcModeDDObjAndPrimarySurface(
  1052.         [in] LPDIRECTDRAW7 lpDDObj,
  1053.         [in] LPDIRECTDRAWSURFACE7 lpPrimarySurf
  1054.         );
  1055.  
  1056.     HRESULT GetXlcModeDDObjAndPrimarySurface(
  1057.         [out] LPDIRECTDRAW7* lpDDObj,
  1058.         [out] LPDIRECTDRAWSURFACE7* lpPrimarySurf
  1059.         );
  1060. }
  1061.  
  1062.  
  1063. //=====================================================================
  1064. //
  1065. // IVPManager
  1066. //
  1067. //=====================================================================
  1068. [
  1069.     local,
  1070.     object,
  1071.     local,
  1072.     uuid(aac18c18-e186-46d2-825d-a1f8dc8e395a),
  1073.     helpstring("IVPManager Interface"),
  1074.     pointer_default(unique)
  1075. ]
  1076. interface IVPManager : IUnknown
  1077. {
  1078.     // Use this method on a Multi-Monitor system to specify to the
  1079.     // video port manager filter which videoport index is used
  1080.     // to an upstream decoder filter.
  1081.     //
  1082.     HRESULT SetVideoPortIndex(
  1083.         [in] DWORD dwVideoPortIndex // the video port number that this is connected to
  1084.         );
  1085.  
  1086.     // This method returns the current video port index being used by the VPM.
  1087.     //
  1088.     HRESULT GetVideoPortIndex(
  1089.         [out] DWORD* pdwVideoPortIndex // the video port number that this is connected to
  1090.         );
  1091. };
  1092.  
  1093.